package com.stu.vertx.hello.webservice.impl;

import com.stu.vertx.hello.entity.OtherInfo;
import com.stu.vertx.hello.entity.ResultInfo;
import com.stu.vertx.hello.webservice.WeatherInterface;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import java.util.ArrayList;

@WebService(
        targetNamespace="http://service.cn_lc",
        name="WeatherWSSoap",
        portName="WeatherWSSoapPort",
        serviceName="WeatherWS"
)//只加这个注解就只能生成SAOP1.1的WSDL
//@BindingType(SOAPBinding.SOAP12HTTP_BINDING)
public class WeatherInterfaceImpl implements WeatherInterface {
    @WebMethod(
            operationName="getWeather",
            exclude=false
    )
    @Override
    public @WebResult(name="resultWeather")String queryWeather(@WebParam(name="cityName")String cityName) {
        System.out.println("form client ..." + cityName);
        switch (cityName){
            case "广州":
                return "晴天";
            case "深圳":
                return "阴天";
            case "四川":
                return "雨天";
            default:
                return "匹配失败";
        }
    }

    @WebMethod(
            operationName="getList",
            exclude=false
    )
    @Override
    public @WebResult(name="resultList")ArrayList<String> getList(@WebParam(name="listName")String listName) {
        ArrayList<String> list1 = new ArrayList<>();
        list1.add("11");
        list1.add("22");
        list1.add("33");
        list1.add("44");
        list1.add("55");
        return list1;
    }

    @WebMethod(
            operationName="getObject",
            exclude=false
    )
    @Override
    public @WebResult(name="objectList")
    ResultInfo getObject(@WebParam(name="objectName")String listName) {
        ArrayList<String> list1 = new ArrayList<>();
        list1.add("11");
        list1.add("22");
        list1.add("33");
        list1.add("44");
        list1.add("55");
        OtherInfo otherInfo = new OtherInfo("idCard", "football");
        ResultInfo resultInfo = new ResultInfo("1","aa","13",list1,otherInfo);
        return resultInfo;
    }



}